let newsinfo = require("../model/newinfo");
let { Router } = require("express");
let router = new Router();
let lists = require("../static/newsinfo.js");
Promise.all(lists().forEach((item) => newsinfo.create(item)))
  .then((res) => {
    console.log(res);
  })
  .catch((error) => console.log(error));

router.post("/allnewsinfo", async (req, res) => {
  let datas = await newsinfo.find().sort({ _id: -1 });
  res.status(200).json({
    msg: "查询成功",
    datas,
  });
});
module.exports = router;
